package com.web.base.log.service;

import com.blue.jdbc.JdbcDataSource;
import com.blue.jdbc.Page;
import com.web.base.log.dao.SmsDao;
import com.web.base.log.model.Sms;
import com.web.core.util.Const;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 短信日志业务层
 * 
 * @author 代码由 blue-code 框架生成
 * @since 1.0 2017年11月21日
 */
@Service("logSmsService")
@Transactional
@JdbcDataSource(Const.DS_BASE)
public class SmsService
{
	@Autowired
	private SmsDao smsDao;
	
	public SmsService()
	{
	}
	
	public Sms save(Sms sms)
	{
		if (sms.getId() == null)
		{
			smsDao.save(sms);
		}
		else
		{
			smsDao.update(sms);
		}
		Sms a = smsDao.get(sms.getId());
		return a;
	}
	
	public Sms get(Integer id)
	{
		Sms sms = smsDao.get(id);
		return sms;
	}
	
	public Page<Sms> list(Sms sms, Page<Sms> page)
	{
		page = smsDao.list(sms, page);
		return page;
	}
	
	public List<Sms> list(Sms sms)
	{
		List<Sms> list = smsDao.list(sms);
		return list;
	}
	
	public void delete(Sms sms)
	{
		smsDao.delete(sms);
	}
	
}
